-
Notifications
You must be signed in to change notification settings - Fork 13.8k
server: split server.cpp code into server/common/task/queue #17362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: split server.cpp code into server/common/task/queue #17362
Conversation
|
Ok seems like windows CI are failing due to cloudflare outage: https://www.cloudflarestatus.com/incidents/8gmgl950y3h7 |
|
Yeah, the CIs are completely unreliable today due to the CloudFlare thingy. |
| STOP_TYPE_LIMIT, | ||
| }; | ||
|
|
||
| struct task_params { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: slot_params is renamed to task_params as I think it's a more appropriate name
|
|
||
| #define JSON_ASSERT GGML_ASSERT | ||
| #include <nlohmann/json.hpp> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it won't be very difficult to include just <nlohmann/json_fwd.hpp> here. For example server-queue.cpp currently indirectly includes nlohmann/json.hpp while it does not need it. We can fix this later.
…gml-org#17362) * add server-task, server-common"
This PR splits the
server.cppinto small components:server.cppcontains theserver_context,server_slotand handler functionsserver-commoncontaining most of the functions fromutils.hpp(some one-off functions are moved toserver-task)server-taskcontaining allserver_task_*classes and subclasses. The main idea is to consider these classes as serializer/deserialize. In the future, most of the JSON handling will be done here (instead of scattering across the code base)server-queuecontaining implementation of task queue and result queue. The goal is to group all of the mutex-related logic into one file, potentially reusing them for other things in the future (completely decoupled from other parts of server)flowchart TD server_common -.- main server_task -.- server_slot server_task -.- server_queue server_slot <-->|update slots| server_context server_queue -->|get task| server_context HTTP_handlers -->|post task| server_queue subgraph main server_slot server_context -.- HTTP_handlers end